\documentclass[fancy]{ctexbook}
\begin{document}
\frontmatter
\chapter{前言}
\tableofcontents
\addcontentsline{toc}{chapter}{目录}

\mainmatter
\chapter{正文}

\backmatter
\chapter{后记}
\chapter{致谢}
\chapter{参考文献}
\end{document}